package com.company;

import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.image.BufferedImage;

/**
 * 机器人
 */
public class RB {

    private static Robot robot;

    static {
        try {
            robot = new Robot();
            robot.setAutoWaitForIdle(true);
            robot.setAutoDelay(30);
        } catch (AWTException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
    static void rightClick(){
        robot.mousePress(InputEvent.BUTTON3_MASK);
        robot.mouseRelease(InputEvent.BUTTON3_MASK);
    }

    public static void move(int x, int y){
        robot.mouseMove(x,y);
    }

    static Color getColor(int x, int y){
        return robot.getPixelColor(x,y);
    }

    static BufferedImage createScreenCapture(Rectangle rectangle){
        return robot.createScreenCapture(rectangle);
    }


}
